			// index.js
			// 获取应用实例
			const app = getApp()

			Page({

			/**
				* 页面的初始数据
				*/
			data: {
				getUserInfo:{},
				getSexName:{},
				sexName:"",
				finalSex:"",
				currentUserId:"",
				order:{},
				remark:{},
				test:"1234"
			},
			onChange(event) {
				this.setData({
				  activeNames: event.detail,
				});
			  },
			getRecord(){
				wx.request({
					url: 'http://127.0.0.1:8088/order/detail/'+this.currentUserId,
					method:'POST',
					header:{
					 'Authorization':wx.getStorageSync('token')	
					},
					success:(result)=>{
						this.order=result.data.order
						this.remark=result.data.remark
						console.log(this.order)
						console.log(this.remark)
						console.log(this.order[0])
						wx.setStorageSync('remark', this.remark)
						wx.setStorageSync('order', this.order)
						this.setData({
							getRemake: wx.getStorageSync('userInfo')
						});
						this.test="5678"
					},
					fail:(res)=>{
						console.log(res)
					}
					
				  })
			},
			getUserInfo(){
				wx.getUserProfile({
					desc: '用于完善会员资料', // 声明获取用户个人信息后的用途，后续会展示在弹窗中，请谨慎填写
					success: (res) => {
					let {avatarUrl,nickName,gender,country,province,city }=res.userInfo;
						wx.request({
							url: 'http://127.0.0.1:8088/mini/update/info',
							method: 'POST',
							header:{
								'Authorization':wx.getStorageSync('token')
						
							},
							data:{
							nickName:nickName,
							sex:gender,
							avatar:avatarUrl,
							address:country+province+city,
							openId:wx.getStorageSync('openId')
							},
							success:(res)=>{
								console.log(res);
							},
							fail :(err)=>{
								console.log(err)
							}
						})
					}
				})
			},
			/**退出登录 */
         logout(){
				 wx.clearStorageSync();
				//  wx.exitMiniProgram();
			},
			/**
				* 生命周期函数--监听页面加载
				*/
			onLoad: function (options) {
				console.log(wx.getStorageSync('userInfo'))
				this.currentUserId=wx.getStorageSync('userInfo').id
				console.log(this.currentUserId)
				wx.request({
					url: 'http://127.0.0.1:8088/order/detail/'+this.currentUserId,
					method:'POST',
					header:{
					 'Authorization':wx.getStorageSync('token')	
					},
					success:(result)=>{
						this.order=result.data.order
						this.remark=result.data.remark
						console.log(this.order)
						console.log(this.remark)
						console.log(this.order[0])
						wx.setStorageSync('remark', this.remark[0])
						wx.setStorageSync('order', this.order[0])
						this.setData({
							getRemake: wx.getStorageSync('userInfo')
						});
						this.test="5678"
					},
					fail:(res)=>{
						console.log(res)
					}
					
				  })
				let res=wx.getStorageSync('userInfo')
				if(res.sex==0){
                     this.sexName='男'
				}else{
					 this.sexName='女'
				}
				console.log(this.sexName,666)
				wx.setStorageSync('sexName', this.sexName)
				this.setData({
					getUserInfo: wx.getStorageSync('userInfo')
				});
				this.setData({
					remark: wx.getStorageSync('remark')
				})
					this.setData({
					order: wx.getStorageSync('order')
				})
			},

			/**
				* 生命周期函数--监听页面初次渲染完成
				*/
			onReady: function () {
	
			},

			/**
				* 生命周期函数--监听页面显示
				*/
			onShow: function () {	 
               this.getTabBar().init();
			},

			/**
				* 生命周期函数--监听页面隐藏
				*/
			onHide: function () {
				
			},

			/**
				* 生命周期函数--监听页面卸载
				*/
			onUnload: function () {
				
			},

			/**
				* 页面相关事件处理函数--监听用户下拉动作
				*/
			onPullDownRefresh: function () {
				
			},

			/**
				* 页面上拉触底事件的处理函数
				*/
			onReachBottom: function () {
				
			},

			/**
				* 用户点击右上角分享
				*/
			onShareAppMessage: function () {
				
			}
			})